% Define knots
t = 0:5; % Assuming that we need a knot vector with enough knots for i = 1, 2, 3.

% Define a range of x values
x_range = linspace(min(t), max(t), 1000);

% Plot the quadratic B-spline for i = 1, 2, 3
figure;
hold on; % Hold on to plot multiple graphs
n = 2;  % Quadratic B-spline
for i = 1:3
    B2 = B(i, n, x_range, t);
    plot(x_range, B2, 'DisplayName', sprintf('B_%d^2(x)', i));
end

% Enhancing the plot
xlabel('x');
ylabel('B_i^2(x)');
title('Quadratic B-splines B_1^2(x), B_2^2(x), and B_3^2(x)');
legend show;
hold off; % Release the plot hold
